Sales By Country and Category

orders <- ggplot(data = Sales_Export_2019_2020, aes(x = country, y = order_value_EUR, fill = category)) + geom_smooth(aes(group = category)) + scale_y_continuous(labels = scales::comma) + theme(axis.text.x = element_text(angle = 45, hjust = 1)) 

ggplotly(orders)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
#Total Sales of each category by country 
TCCSales <- ggplot(data = CountryTotalSaleExport, aes(x = country, y = saleCategoryTotal, fill = category)) +
  geom_col() + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + labs(title = "Total Sales of Each Countries Exports by Category (2019-2020))", x = "Country", y = "Cost Total") + scale_y_continuous(labels = scales::comma) 

ggplotly(TCCSales)

Cost Per Category for Each Country

#Total cost of each category by country
TCCCost <- ggplot(data = CountryTotalcostExport, aes(x = country, y = costCategoryTotal, colour = category)) + geom_point() + geom_line(aes(group = category)) + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + labs(title = "Total Cost of Each Countries Exports by Category (2019-2020))", x = "Country", y = "Cost Total") + scale_y_continuous(labels = scales::comma) 

ggplotly(TCCCost) 

Gross Profit for Each Country

#Gross Profit by country
CGProfit <- ggplot(data = CountryProfit, aes(x = reorder(country, GrossProfit), y = GrossProfit)) + geom_point() + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + labs(title = "Cross Profit Per Country (2019-2020))", x = "Country", y = "Total Gross Profit") + scale_y_continuous(labels = scales::comma) 

ggplotly(CGProfit)

Gross Profit based on Category

#Gross Profit by category
CProfit <- ggplot(data = CategoryProfit, aes(x = category, y = GrossProfit, fill = category, )) + geom_tile(aes()) +  scale_y_continuous(labels = scales::comma) + theme(axis.text.x = element_text(angle = 45, hjust = 1)) 

ggplotly(CProfit)
#Loop that creates a p char for every country
for (country in unique(CoProfit$country)) { country_data <-
CoProfit %>% filter(country == country)

pie_chart <- ggplot(data = country_data, aes(x = "", y = GProfit, fill
= category)) + geom_bar(stat ="identity") + coord_polar(theta = "y") +
theme_void() + labs(title = paste("Total Gross Profit based on Category
Contribution -", country))

print(pie_chart)

}